The present invention relates to managing physical memory in a virtual memory computer.
A virtual memory system automatically moves a program""s data back and forth between slower, lower-cost secondary memory and faster, higher-cost, primary memory, so that the program""s more-referenced data tend to reside in a faster memory, and less-referenced data tend to reside in the slower memory. A program""s data are divided into fixed-size blocks, called xe2x80x9cpages.xe2x80x9d More-referenced pages are kept in primary storage. As references to the page become less frequent, the less-referenced page is moved to secondary storage. In a computer with a virtual memory system, programs reference data by virtual address. Address translation hardware translates program-visible virtual addresses to physical addresses a physical address is the address in primary memory at which the data actually reside.
The translation from virtual addresses to physical addresses is called the xe2x80x9cmapping,xe2x80x9d and is described by a xe2x80x9cpage table,xe2x80x9d a table that associates pages of virtual addresses to pages of physical addresses. The page table is itself divided into pages. The pages of the page table are typically arranged as a tree, with a base pointer forming the root at the top of the tree, higher-level nodes in the tree indicating the mapping at coarser levels and lower-level nodes in the tree indicating the mapping at finer levels. The memory pages actually read, written, and executed by programs form the leaf nodes at the bottom of this tree.
Virtual memory systems and multi-level address translation are described in xe2x80x9cStructured Computer Organization,xe2x80x9d second edition, by Andrew S. Tanenbaum, Prentice-Hall, 1984; xe2x80x9cVAXNMS Internals and Data Structures,xe2x80x9d by Lawrence J. Kenah and Simon F. Bate, Digital Press, 1984; xe2x80x9cOpenVMS AXP Internals and Data Structures, Version 1.5xe2x80x9d by R. Goldenberg ad S. Saravanan, Digital Press, 1994; xe2x80x9cExtending OpenVMS for 64-bit Addressable Virtual Memory,xe2x80x9d Digital Technical Journal vol 8 no.2 (1996), and xe2x80x9cAlpha AXP Architecture Reference Manual,xe2x80x9d second edition, by Richard L. Sites and Richard T. Witek, Digital Press, 1995, each incorporated herein by reference.
It is known to provide shared memory among multiple processes executing on a computer. In a typical implementation, two processes agree on the physical page number in which the shared data are stored, and the page tables of the two processes are each set to point to that agreed physical page.
In general, in a first aspect, the invention features a method for use in a computer. A user of the computer stores a selection in a permanent memory structure, indicating a memory object and one of at least two memory management policies for the designated memory object. Physical pages of the designated memory object are managed according to the stored selection.
Embodiments of the invention may include one or more of the following features. The designated memory object may be a page of a memory object simultaneously shared by two processes. The selected policy may specify whether pages of the designated object are to be reserved, or to be faulted on demand. The selected policy may specify whether pages of the designated memory object are to be locked into physical memory of the computer, or to be demand paged from a fluid page pool. The selected policy may specify whether the allocated pages are to be zeroed; pages to be zeroed maybe zeroed during the system idle loop. The selected policy may specify the number of levels of page table pages for the designated memory object to be shared. The selected policy may specify that the designated memory object may be, to be allocated in contiguous pages of physical memory. The designated memory object may be a page table page describing a virtual-to-physical address mapping for memory references to a program-accessible page. Page tables may be constructed at the time of memory allocation. The policy selection and an allocation size explicitly stored in the permanent memory structure may refer to management of the program-accessible page, while a size of an allocation embracing the page table page may be inferentially computed from the stored size for the program-accessible allocation. The designated memory object may be a shared page table page for a memory object simultaneously mapped by two processes.
In a second aspect, the invention features a method for operation of a computer. From among the memory managed by a virtual memory manager, a pool of physical memory is designated as non-pageable. Memory from the designated pool is mapped in response to a request from a non-privileged program.
Some embodiments may feature one or more of the following. A symbolic name may be assigned to the designated pool, and processes may request memory from the pool by referring to the symbolic name. During execution of an operating system of the computer, the designated pool may be freed to the system fluid page pool. Memory may be allocated for page tables of the program-accessible pages in response the request. An operating system may enforce a privilege right to allocate memory from the designated pool, and allow a non-privileged program to attach to the allocated memory. Memory may be allocated from a fluid page pool if an allocation request from the designated pool exceeds the remaining contents of the designated pool.
Specific embodiments of the invention may offer one or more of the following advantages.
Performance of Very Large Memory (VLM) systems (computer systems with over 4 GB of main memory, requiring more than 32 bits of addressing) is improved. VLM applications typically consume large amounts of physical memory in an attempt to minimize disk input/output (I/O) and enhance overall application performance. A VLM system allows large amounts of data to remain resident in main memory, thereby reducing the time required to access that data. For example, database cache designers implement large-scale caches on VLM systems to improve the access times for database records. Similarly, VLM database applications support more server processes. The combination of large in-memory caches and increased number of server processes significantly reduces the overall time database clients wait to receive the data requested.
Users of VLM systems can memory map very large shared memory objects (gigabytes in size) that use a multi-level shared page table structure to create and access the shared memory with a single handle. Users are not required to make major changes to their applications to take advantage of the invention. Instead, the original shared memory object handle name encoded in the application can be used to create and access shared memory that will exhibit better physical memory and CPU utilization characteristics. VLM objects exhibit the same basic characteristics (from the programmer""s perspective) as other virtual memory objects created with conventional service programming interfaces. Implementations may choose not to charge the shared memory object or its page tables against a users page quota, reducing the risk of un-anticipated exhaustion of a working set or pagefile quota. Program start-up times are reduced. The time required for multiple users to map the same object is reduced. The improved management of memory improves performance when multiple VLM applications are run on a single system.
Shared memory objects with shared page tables exhibit better physical memory and central processing unit (CPU) utilization since the page table structure that maps the shared memory is also shared among the processes that wish to access the shared memory. Significant processor time is saved in creating and deleting virtual address mappings to those shared memory objects. Contention is reduced for the locks serializing access to memory management data structures. There is a savings in physical memory required for the process private page tables that map a shared memory object for each process mapping the object. More concurrent users may access each shared memory object, with less risk of exhausting computer memory resources. More processes may be simultaneously resident in memory, reducing process swapping. The physical memory cost of creating and maintaining private page tables for multiple mappers of the same object is reduced. The use of a backing storage file for shared page tables pages is reduced. Working set list accounting for these page table pages is reduced. The design allows upper levels of the page table hierarchy to be shared. By sharing leaf pages and page table pages using common mechanisms, the creation of new privileges or access rights is reduced. There is less impact on users who do not use shared page tables.
System management of a VLM system is simplified. A Reserved Memory Registry may support memory reservations for memory-resident global sections and shared page tables.
The Reserved Memory Registry provides a physical memory reservation system that can be exploited by VLM applications. The Registry provides portions of the system""s physical memory to non-privileged processes. A non-privileged process can request physical memory to make the most efficient use of system components. This reservation of physical memory may, in turn, improve utilization of the translation buffer. More efficient use of the CPU and its peripheral components leads to increased application performance. Shared memory objects may be created that do not page to disk.
The invention may simplify the creation and mapping of a shared memory object that utilizes a shared multi-level page table structure by enabling only a single handle to specify both the shared memory leaf object and the correspondent shared page tables. The system determines whether the shared leaf object can be created with shared page tables, and secondarily, by applying certain mapping criteria, whether the object can be mapped into a user""s address space using shared page tables. The user has the option of adhering to or violating the mapping criteria as a means to control whether the shared memory object is mapped using shared page tables or process private page tables.
The following table highlights the physical memory requirements for private page tables that map to various sizes of global sections by various numbers of processes. This table illustrates the amount of physical memory saved system wide through the use of shared page tables. (All of the figures assume a system page size of 8 Kbytes.)
It is not intended that the invention be summarized here in its entirety. Rather, further features, aspects and advantages of the invention are set forth in or are apparent from the following description and drawings.